*********************************
** Logan Strother              **
** Replication File            **
** Journal of Law & Courts     **
** Beyon Kelo: Exp. Study      **
** MTurk Experiment            **
** 6/10/15 - 4/22/16           **
*********************************

version 14.1
set more off, permanently
set matsize 800

* log

* user will need to specify appropriate data file location
use "C:\Users\Logan\Desktop\Kelo to Keystone\Drafts\JLC Draft\JLC Final\Replication Files\Strother - JLC_Replication_Data.dta" 

*** Code to create Figure 2 ***
* for actual fig 2 presented in article I copied the values reported in the following code into Excel
* because the resulting bargraph was a little nicer, presentationally
* but, this code creates the exact same graph, substantively
#delimit ;
graph bar vitalp roadp infrap schoolp developp, bargap(10) 
ytitle("Percent Support Taking") ylabel(0(10)70, angle(0))
bar(1, color(gray)) bar(2, color(gray)) bar(3, color(gray))
bar(4, color(gray)) bar(5, color(gray))
blabel(bar, format(%4.2f))
b1title("Vital Purp.        Road         Infra.          School        Econ Dev")
b2title("Purpose of Taking")
legend(off);
#delimit cr
* graph save Graph "C:\Users\Logan\Desktop\Kelo to Keystone\Drafts\JLC Draft\JLC R&R\JLC_fig2_bargraph.gph"

*** Code to create Figure 3 ***
* First, calculate treatment effects:
reg supptemdom0to1 Imagine
* m= 0.0254 sd= 0.027
reg supptemdom0to1 PropType
* m= -0.207 sd=0.0278
reg supptemdom0to1 TakePurp
* m= 0.091 sd= 0.0276
reg att0to1 Imagine
* m= 0.0302 sd= 0.0217
reg att0to1 PropType
* m= -0.0235 sd= 0.0217
reg att0to1 TakePurp
* m= 0.0957 sd= 0.0215
reg anger0to1 Imagine
* m= 0.0544 sd= 0.0233
reg anger0to1 PropType
* m= -0.0106 sd= 0.0233
reg anger0to1 TakePurp
* m= 0.0947 sd= 0.0231
reg cong0to1 Imagine
* m= 0.0015 sd= 0.0209
reg cong0to1 PropType
* m= -0.0157 sd= 0.0209
reg cong0to1 TakePurp
* m= 0.0562 sd= 0.0208
* put data in excel by hand, built graphs in separate code *
* see JLC Fig 3 Graphs do file to build each graph, then combine (detail in graph do file)*


*** Code to create Table 2 ***
oprobit supportemdom Imagine PropType TakePurp ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
outreg2 using JLC_table2.doc, replace ctitle(OProbit coeffs)
oprobit attitude_intensity Imagine PropType TakePurp ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
outreg2 using JLC_table2.doc, append ctitle(OProbit coeffs)
oprobit angry Imagine PropType TakePurp ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
outreg2 using JLC_table2.doc, append ctitle(OProbit coeffs)
oprobit congbill Imagine PropType TakePurp ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
outreg2 using JLC_table2.doc, append ctitle(OProbit coeffs)

*** Code to estimate marginal effects reported in text
* levels of support in and out of the "Mall" treatment *
quietly oprobit supportemdom Imagine PropType TakePurp ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
margins, at(TakePurp=(0 1)) atmeans post
* levels of support in and out of "Home" treatment *
quietly oprobit supportemdom Imagine PropType TakePurp ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
margins, at(PropType=(0 1)) atmeans post
* levels of support in and out of "Imagine" treatment *
quietly oprobit supportemdom Imagine PropType TakePurp ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
margins, at(Imagine=(0 1)) atmeans post
* changes in attitude intensity in and out of "Mall" treatment 
quietly oprobit attitude_intensity Imagine PropType TakePurp ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
margins, at(TakePurp=(0 1)) atmeans post
* changes in anger in and out of Mall Treatment
quietly oprobit angry Imagine PropType TakePurp ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
margins, at(TakePurp=(0 1)) atmeans post
* changes in support for Cong Bill in and out of Mall Treatment
quietly oprobit congbill Imagine PropType TakePurp ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
margins, at(TakePurp=(0 1)) atmeans post


*** Code for Tables in Appendix
* Demographic breakdown in MTurk sample [Table B1]
tab gender
tab gender if Imagine==1
tab gender if PropType==1
tab gender if TakePurp==1
tab partyid if Imagine==1
tab partyid if PropType==1
tab partyid if TakePurp==1
tab ideology2 if Imagine==1
tab ideology2 if PropType==1
tab ideology2 if TakePurp==1
tab race if Imagine==1
tab race if PropType==1
tab race if TakePurp==1
tab educ if Imagine==1
tab educ if PropType==1
tab educ if TakePurp==1
* values were copied into excel to create final table b1

*** Randomization check for experimental treatments [Table B3]
logit Imagine ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
outreg2 using RandCheck.doc, replace ctitle(Logit coeffs)
logit PropType ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
outreg2 using RandCheck.doc, append ctitle(Logit coeffs)
logit TakePurp ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
outreg2 using RandCheck.doc, append ctitle(Logit coeffs)

* [Table C1]
oprobit supportemdom Imagine PropType TakePurp HomeMall ImagineHome ImagineMall
outreg2 using JLC_INT.doc, replace ctitle(OProbit coeffs)
oprobit attitude_intensity Imagine PropType TakePurp HomeMall ImagineHome ImagineMall
outreg2 using JLC_INT.doc, append ctitle(OProbit coeffs)
oprobit angry Imagine PropType TakePurp HomeMall ImagineHome ImagineMall
outreg2 using JLC_INT.doc, append ctitle(OProbit coeffs)
oprobit congbill Imagine PropType TakePurp HomeMall ImagineHome ImagineMall
outreg2 using JLC_INT.doc, append ctitle(OProbit coeffs)

* [Table C2]
oprobit supportemdom Imagine PropType TakePurp ideology partyid trust_govt corrupt_govt prop_rights libert_therm business_therm age_group race educ income gender own years_home childhood_home
outreg2 using JLC_KS.doc, replace ctitle(OProbit coeffs)
oprobit attitude_intensity Imagine PropType TakePurp ideology partyid trust_govt corrupt_govt prop_rights libert_therm business_therm age_group race educ income gender own years_home childhood_home
outreg2 using JLC_KS.doc, append ctitle(OProbit coeffs)
oprobit angry Imagine PropType TakePurp ideology partyid trust_govt corrupt_govt prop_rights libert_therm business_therm age_group race educ income gender own years_home childhood_home
outreg2 using JLC_KS.doc, append ctitle(OProbit coeffs)
oprobit congbill Imagine PropType TakePurp ideology partyid trust_govt corrupt_govt prop_rights libert_therm business_therm age_group race educ income gender own years_home childhood_home
outreg2 using JLC_KS.doc, append ctitle(OProbit coeffs)

* [Table C3]
oprobit supportemdom Imagine PropType TakePurp ImagineHome ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
outreg2 using JLC_ND.doc, replace ctitle(OProbit coeffs)
oprobit attitude_intensity Imagine PropType TakePurp ImagineHome ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
outreg2 using JLC_ND.doc, append ctitle(OProbit coeffs)
oprobit angry Imagine PropType TakePurp ImagineHome ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
outreg2 using JLC_ND.doc, append ctitle(OProbit coeffs)
oprobit congbill Imagine PropType TakePurp ImagineHome ideology partyid trust_govt prop_rights libert_therm business_therm age_group gender race educ income
outreg2 using JLC_ND.doc, append ctitle(OProbit coeffs)

* clear
